Carlos Garnacho [Wed, 14 May 2014 11:05:41 +0000 (13:05 +0200)]
spinbutton: Attach "swipe to spin" controllers to the bubble phase
It is unnecessary to have those process events manually, just attach
those to the bubble phase.
Carlos Garnacho [Wed, 14 May 2014 10:56:16 +0000 (12:56 +0200)]
colorplane: Fully port to GtkGesture
A GtkGestureDrag is used for color selection, removing also the
need to track the pointer state in widget data. The GDK grab performed
just to set the crosshair cursor has been replaced by a call
to gdk_window_set_device_cursor(), which will be unset if the
drag operation is finished, or cancelled due to the implicit grab
being broken.
Carlos Garnacho [Wed, 14 May 2014 10:53:54 +0000 (12:53 +0200)]
gdk: Lookup both device and global cursor when checking up the hierarchy
When the pointer cursor is updated on CSW, lookup for either a device
cursor, or a global one. It would previously lookup for windows with
a global cursor, and then check if it had a device cursor, which would
skip windows with only device cursors set, and unexpectedly set the
global cursor.
Carlos Garnacho [Mon, 12 May 2014 17:52:35 +0000 (19:52 +0200)]
button: Make multipress gesture exclusive
We only want actions to be triggered by a single sequence there,
so buttons trigger no actions on further simultaneous touches
happening.
Carlos Garnacho [Mon, 12 May 2014 17:50:26 +0000 (19:50 +0200)]
gesturesingle: Add an "exclusive" boolean property
All "exclusive" gestures listen for either pointer events, or
"pointer emulating" touch events, so only a single sequence at
a time can make these run.
Carlos Garnacho [Mon, 12 May 2014 17:12:27 +0000 (19:12 +0200)]
button: Use GtkGestureMultiPress for signal emission
It is now useful for that purpose with a ::release signal, so replace
the custom GtkGestureSingle with one of these.
Carlos Garnacho [Mon, 12 May 2014 17:11:53 +0000 (19:11 +0200)]
drag: Allow gtk_gesture_get_start_point/offset() to be called on ::drag-end
Carlos Garnacho [Mon, 12 May 2014 15:02:03 +0000 (17:02 +0200)]
multipress: Add matching ::released signal
This signal will always be paired with a ::pressed signal, unless
the sequence is cancelled, or the controller is reset. the n_press
argument in the signal always matches the ::press signal one, even
if GtkGestureMultiPress::stopped was emitted in between.
Carlos Garnacho [Mon, 12 May 2014 14:56:41 +0000 (16:56 +0200)]
multipress: Protect against fleeting touches mistriggering events
The current sequence (as per gtk_gesture_single_get_current_sequence)
is used to find out the coordinates. And only emit ::pressed if the
gesture began through a GDK_BUTTON_PRESS/TOUCH_BEGIN (eg. not due to
an extra touch being lifted)
Carlos Garnacho [Sat, 10 May 2014 18:59:55 +0000 (20:59 +0200)]
textview: Set up controllers on the GTK_PHASE_TARGET propagation phase
This way events are managed by gestures in the event handlers themselves,
respecting the execution order already assumed by subclasses around.
Carlos Garnacho [Sat, 10 May 2014 18:52:17 +0000 (20:52 +0200)]
widget: Hook GTK_PHASE_TARGET controllers to the default event handlers
Just call the controllers on that phase if the default widget handlers
are run.
For compatibility reasons, in the touch event handler, let the pointer
emulating touch be transformed to a pointer event as usual, in order to
have widget handlers a chance to run at all. If they have to be managed
by a controller in that phase, it'll have to be through the default pointer
event handlers.
Carlos Garnacho [Sat, 10 May 2014 18:50:23 +0000 (20:50 +0200)]
gesture: Add GTK_PHASE_TARGET
This phase is meant to run in the default widget handlers, as opposed
to externally as in the bubble/capture phase. This will be most usually
the expected phase for every controller replacing code in event handlers
in GTK+, just so invocation and triggering order is kept unaltered.
Carlos Garnacho [Sat, 10 May 2014 18:46:47 +0000 (20:46 +0200)]
gesture: Handle GdkEventGrabBroken
That may happen separately from grab-notify, and also due to external
reasons, so ensure all sequences are cancelled if a grab is taken
in some GdkWindows that would obscure events on the controller.
Matthias Clasen [Fri, 9 May 2014 23:24:27 +0000 (19:24 -0400)]
GtkColorSwatch: Use gesture for button events too
Matthias Clasen [Fri, 9 May 2014 22:55:48 +0000 (18:55 -0400)]
GtkWindow: Only use a multipress gesture for toplevels
There is no point in creating and attaching this gesture
for override-redirect windows, so don't do it.
Matthias Clasen [Fri, 9 May 2014 19:53:27 +0000 (15:53 -0400)]
Be careful about the list of event controllers
We can end up with _gtk_widget_remove_controller getting called
while we are iterating over the list in _gtk_widget_run_controllers.
To avoid trouble, only mark the event controller as dead by
setting data->controller to NULL, and defer the actual freeing
and list manipulation to the loop in _gtk_widget_run_controllers.
Update other places that operate on controllers to handle
data->controller being NULL.
Carlos Garnacho [Fri, 9 May 2014 11:19:12 +0000 (13:19 +0200)]
textview: Convert gestures' coordinates to text window ones
And make some code shared between multipress/drag gesture.
Carlos Garnacho [Thu, 8 May 2014 14:28:49 +0000 (16:28 +0200)]
textview: Use GtkGestureDrag for text selection/DnD
remaining code in button press/release, motion notify, and grab
notify handlers has been shuffled to be managed by this gesture.
Carlos Garnacho [Wed, 7 May 2014 11:15:30 +0000 (13:15 +0200)]
textview: Use GtkGestureMultiPress for click handling
The button press handler is no longer necessary, and most of its
code has been shuffled into the GtkGestureMultiPress::pressed
handler.
Carlos Garnacho [Wed, 7 May 2014 17:08:50 +0000 (19:08 +0200)]
widget: tighten the conditions at which a press event is emulated
Make it really sure that the event is only emitted after every gesture
that consumed the button press is done with the sequence.
The event must only be emulated if a gesture in the capture phase happened
to consume the event, be cancelled, and
Carlos Garnacho [Wed, 7 May 2014 17:06:42 +0000 (19:06 +0200)]
widget: Fix gesture event handler retval for bubbled events
Do not clobber the return value if the regular event handler happens
to return FALSE, even if the gesture meant to consume the event.
Carlos Garnacho [Wed, 7 May 2014 09:18:00 +0000 (11:18 +0200)]
gesture: Prevent against sequence cancellation within gtk_gesture_set_state()
Sequences may be cancelled within the ::sequence-state-changed handler, which
would change the points hashtable as it's being iterated in this function. So
iterate over a list of sequences and let the hashtable change freely.
Carlos Garnacho [Tue, 6 May 2014 16:22:57 +0000 (18:22 +0200)]
gesture: Make gtk_gesture_get_last_update_time() private
Carlos Garnacho [Tue, 6 May 2014 16:18:10 +0000 (18:18 +0200)]
gesture: Remove gtk_gesture_get_last_event_type
Carlos Garnacho [Tue, 6 May 2014 16:10:32 +0000 (18:10 +0200)]
gesture: make gtk_gesture_cancel_sequence() private
Carlos Garnacho [Tue, 6 May 2014 16:04:25 +0000 (18:04 +0200)]
gesture: Make gtk_gesture_check() private
Carlos Garnacho [Tue, 6 May 2014 15:27:17 +0000 (17:27 +0200)]
dnd: Check on the right gesture sequence when starting the drag op
Carlos Garnacho [Tue, 6 May 2014 13:50:01 +0000 (15:50 +0200)]
gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.
The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.
All callers have been updated.
Carlos Garnacho [Tue, 6 May 2014 13:25:31 +0000 (15:25 +0200)]
widget: Keep a widget reference around _gtk_widget_run_controllers()
The widget may be destroyed within the loop, in reaction to the signals
sent by the controllers. Protect against that.
Carlos Garnacho [Tue, 6 May 2014 13:23:24 +0000 (15:23 +0200)]
gesture: Add explanatory note in GtkGesture::end
Explain that this signal may be triggered by an extra touch that causes
the gesture to surpass GtkGesture:n-points.
Carlos Garnacho [Tue, 6 May 2014 13:20:56 +0000 (15:20 +0200)]
gesture: Cancel sequences that make a gesture exceed the number of touches as they happen
This makes it possible to track those through gtk_gesture_handles_sequence(),
without guessing from last event type or sequence state.
Carlos Garnacho [Tue, 6 May 2014 12:12:13 +0000 (14:12 +0200)]
widget: Change slightly the gesture cancellation policy in a same widget
Within a widget, if a gesture accepts a sequence, it would previously
cancel every other gesture that not in the same group. Change this to
only cancelling gestures that previously claimed the gesture, and let
gestures with state=NONE for that sequence remain like that.
This enables late recognition of gestures, even on the presence of
another gesture group that was more eager at claiming the gesture.
One usecase is user-defined panning gestures on scrolledwindows,
if ::capture-button-press is TRUE (eg. the default), the gesture is
claimed early in order to consume the button press, but that would
tipically make every other gesture group deny the sequence. With
this change, the pan gesture can keep state=NONE, and later claim
the sequence for itself if the panning gesture is recognized.
Also, do not propagate state=DENIED to every gesture in the widget,
that was unintended.
Carlos Garnacho [Tue, 6 May 2014 09:43:31 +0000 (11:43 +0200)]
rotate: Ensure delta is between [0..2π]
Carlos Garnacho [Tue, 6 May 2014 09:39:15 +0000 (11:39 +0200)]
pan: make the direction factor less narrow in v/h directions
Carlos Garnacho [Mon, 5 May 2014 12:21:36 +0000 (14:21 +0200)]
gesture: Handle GDK_TOUCH_CANCEL events
The wayland windowing backend emits such events for instance, so
have gestures cancel the sequence as those events get through.
Carlos Garnacho [Mon, 28 Apr 2014 10:53:36 +0000 (12:53 +0200)]
gesture: Protect against odd window hierarchies
If no match is found with the gesture widget when poking the event
window parents, bail out safely instead of falling in an infinite
loop. This was seen on Mutter.
Carlos Garnacho [Thu, 17 Apr 2014 11:05:11 +0000 (13:05 +0200)]
swipe: Don't emit ::swipe if there are still active touches
Avoids sending spurious signals when an extra touch happens.
Matthias Clasen [Tue, 6 May 2014 02:40:18 +0000 (22:40 -0400)]
Prevent subclassing of gestures
For now, at least. We do this by hiding the instance and
class structures in private headers.
Matthias Clasen [Fri, 2 May 2014 02:05:42 +0000 (22:05 -0400)]
GtkSpinButton: Don't leak the gestures
Matthias Clasen [Fri, 2 May 2014 02:00:01 +0000 (22:00 -0400)]
GtkWindow: Don't leak the gesture
Matthias Clasen [Fri, 2 May 2014 01:53:35 +0000 (21:53 -0400)]
GtkTreeView: Remove unused field
Matthias Clasen [Fri, 2 May 2014 01:01:33 +0000 (21:01 -0400)]
gtk3-demo: Don't leak the color chooser
Matthias Clasen [Fri, 2 May 2014 01:00:28 +0000 (21:00 -0400)]
GtkColorPlane: Actually add the long press gesture
This was missed because gtk_widget_remove_controller silently
does nothing on unowned controllers.
Matthias Clasen [Fri, 2 May 2014 00:58:13 +0000 (20:58 -0400)]
GtkButton: Don't leak the gesture
Matthias Clasen [Fri, 2 May 2014 00:26:40 +0000 (20:26 -0400)]
Forgotten file
Matthias Clasen [Fri, 2 May 2014 00:15:40 +0000 (20:15 -0400)]
GtkButton: Port to GtkGesture
Quick-and-dirty patch to use a GtkGestureSingle for both
button press/release and touch event handling.
Carlos Garnacho [Thu, 10 Apr 2014 11:56:55 +0000 (13:56 +0200)]
widget: remove GtkGesture-related signals
The utility of those signals is somewhat dubious now that there is
gtk_gesture_group(), so make that the only way to coordinate gestures.
The cooperation model offered by gtk_gesture_group() is flexible
enough,
Carlos Garnacho [Thu, 10 Apr 2014 11:46:03 +0000 (13:46 +0200)]
docs: Add missing GtkEventController functions
Carlos Garnacho [Thu, 10 Apr 2014 11:45:38 +0000 (13:45 +0200)]
widget: Add docs for GtkGesture-related API
Carlos Garnacho [Thu, 10 Apr 2014 11:45:19 +0000 (13:45 +0200)]
gesturesingle: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:45:06 +0000 (13:45 +0200)]
zoom: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:45:00 +0000 (13:45 +0200)]
swipe: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:44:49 +0000 (13:44 +0200)]
rotate: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:44:06 +0000 (13:44 +0200)]
pan: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:43:53 +0000 (13:43 +0200)]
multipress: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:43:41 +0000 (13:43 +0200)]
longpress: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:43:27 +0000 (13:43 +0200)]
drag: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:43:15 +0000 (13:43 +0200)]
gesture: doc fixes
Carlos Garnacho [Thu, 10 Apr 2014 11:43:01 +0000 (13:43 +0200)]
eventcontroller: doc fixes
Carlos Garnacho [Wed, 9 Apr 2014 16:29:48 +0000 (18:29 +0200)]
docs: Add missing controller/gesture docs
Carlos Garnacho [Wed, 9 Apr 2014 16:29:02 +0000 (18:29 +0200)]
pan: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:28:49 +0000 (18:28 +0200)]
zoom: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:28:43 +0000 (18:28 +0200)]
rotate: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:28:27 +0000 (18:28 +0200)]
swipe: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:28:20 +0000 (18:28 +0200)]
drag: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:28:12 +0000 (18:28 +0200)]
longpress: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:28:03 +0000 (18:28 +0200)]
multipress: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:27:50 +0000 (18:27 +0200)]
gesturesingle: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:27:42 +0000 (18:27 +0200)]
gesture: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:27:31 +0000 (18:27 +0200)]
eventcontroller: Add missing documentation
Carlos Garnacho [Wed, 9 Apr 2014 16:27:11 +0000 (18:27 +0200)]
enums: Add missing docs to controller/gesture enums
Carlos Garnacho [Tue, 8 Apr 2014 19:27:49 +0000 (21:27 +0200)]
Remove GtkPressAndHold
This is replaced by GtkGestureLongPress, and all its callers have
been updated to use the replacement.
Carlos Garnacho [Tue, 8 Apr 2014 19:27:08 +0000 (21:27 +0200)]
enums: Document GtkPropagationPhase
Carlos Garnacho [Tue, 8 Apr 2014 19:24:54 +0000 (21:24 +0200)]
spinbutton: increase/decrease value on upwards/downwards touch swipes
This is somewhat analogous to scroll events on pointer devices, the
greater the velocity, the faster the spinbutton spins.
Carlos Garnacho [Tue, 8 Apr 2014 19:21:56 +0000 (21:21 +0200)]
Add GtkGesturePan
This gesture reports events on horizontal/vertical panning gestures.
Carlos Garnacho [Tue, 8 Apr 2014 19:21:14 +0000 (21:21 +0200)]
range: Replace GtkPressAndHold with GtkGestureLongPress
Carlos Garnacho [Tue, 8 Apr 2014 19:19:46 +0000 (21:19 +0200)]
swipe: Add function to retrieve the current velocity
This can be used to fetch the current velocity on update(), as opposed
to swipe() which happens after the sequence is finished.
Carlos Garnacho [Tue, 8 Apr 2014 19:18:38 +0000 (21:18 +0200)]
colorswatch: Replace GtkPressAndHold
GtkGestureLongPress and GtkGestureMultiPress are both used
to replace it.
Carlos Garnacho [Tue, 8 Apr 2014 19:17:54 +0000 (21:17 +0200)]
colorscale: Replace GtkPressAndHold with GtkLongPressGesture
Carlos Garnacho [Tue, 8 Apr 2014 19:17:00 +0000 (21:17 +0200)]
colorplane: Replace GtkPressAndHold with GtkLongPressGesture
Carlos Garnacho [Tue, 8 Apr 2014 19:15:06 +0000 (21:15 +0200)]
entry: Don't show text handles too eagerly on button press
Instead do so on button release, or after text selection dragging
starts.
Carlos Garnacho [Tue, 8 Apr 2014 19:11:27 +0000 (21:11 +0200)]
longpress: Ensure check() happens after cancel()
And delegate on GtkGesture::check(), it does deal better with
extra fleeting touches.
Carlos Garnacho [Tue, 8 Apr 2014 19:10:43 +0000 (21:10 +0200)]
longpress: fix reentrancy on ::reset()
Carlos Garnacho [Tue, 8 Apr 2014 19:09:44 +0000 (21:09 +0200)]
gesturemultipress: fix reentrancy on ::reset()
Carlos Garnacho [Tue, 8 Apr 2014 19:06:39 +0000 (21:06 +0200)]
gesturesingle: check the current sequence before resetting the pressed button
Carlos Garnacho [Tue, 8 Apr 2014 19:05:00 +0000 (21:05 +0200)]
scrolledwindow: update to gesture widget-level API changes
Carlos Garnacho [Tue, 8 Apr 2014 19:03:07 +0000 (21:03 +0200)]
window: update to gesture widget-level API changes
Carlos Garnacho [Tue, 8 Apr 2014 19:02:44 +0000 (21:02 +0200)]
treeview: update to gesture widget-level API changes
Carlos Garnacho [Tue, 8 Apr 2014 19:01:47 +0000 (21:01 +0200)]
drag: remove unused #define
Carlos Garnacho [Tue, 8 Apr 2014 19:01:13 +0000 (21:01 +0200)]
eventcontroller: Add documentation blurb
Carlos Garnacho [Tue, 8 Apr 2014 19:00:26 +0000 (21:00 +0200)]
dnd: Update to gesture widget-level API changes
Carlos Garnacho [Tue, 8 Apr 2014 18:59:16 +0000 (20:59 +0200)]
demo: Update to gesture widget-level API changes
Carlos Garnacho [Tue, 8 Apr 2014 18:55:30 +0000 (20:55 +0200)]
widget: refactor gesture integration
Listen for notify::sequence-state-changed on the controller, so the
only way to manipulate a sequence state are gtk_gesture_set_sequence_state()
and gtk_gesture_set_state().
Also, make use of gesture groups, so the sequence state is set at once
on all gestures pertaining to a single group. Within a widget, if a sequence
is claimed on one group, it is made to be denied on every other group.
Carlos Garnacho [Tue, 8 Apr 2014 18:47:38 +0000 (20:47 +0200)]
gesture: Add grouping API
This API eliminates the need for overriding
GtkWidget::sequence-state-changed virtually everywhere. Grouped
gestures share common states for a same GdkEventSequence, so the
state of sequences stay in sync across those.
Carlos Garnacho [Tue, 8 Apr 2014 18:46:26 +0000 (20:46 +0200)]
gesture: Add gtk_gesture_set_state() helper.
This function sets the state on all sequences where it actually
can, just a helper function to avoid iterating over sequences
yourself.
Carlos Garnacho [Tue, 8 Apr 2014 18:45:18 +0000 (20:45 +0200)]
gesture: emit the current state on ::sequence-state-changed
Carlos Garnacho [Tue, 8 Apr 2014 18:44:38 +0000 (20:44 +0200)]
gesture: group continue conditions together
Carlos Garnacho [Tue, 8 Apr 2014 18:43:52 +0000 (20:43 +0200)]
gesture: return TRUE if the sequence state was already set
Carlos Garnacho [Tue, 8 Apr 2014 18:41:09 +0000 (20:41 +0200)]
gesture: fix compiler warning
Carlos Garnacho [Tue, 8 Apr 2014 18:39:44 +0000 (20:39 +0200)]
gesture: ignore events if now widget window was found